package com.learn.spring.service;

import com.learn.spring.dao.IJdbcTemplateDao;
import com.learn.spring.entity.TUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JdbcTemplateService {

    @Autowired
    private IJdbcTemplateDao jdbcTemplateDao;

    public void addUser(TUser user) {
        jdbcTemplateDao.addUser(user);
    }

    public void updateUser(TUser user) {
        jdbcTemplateDao.updateUser(user);
    }

    public void deleteUser(int id) {
        jdbcTemplateDao.deleteUser(id);
    }

    public int findCount() {
        return jdbcTemplateDao.selectCount();
    }

    public TUser findUser(int id) {
        return jdbcTemplateDao.findUserById(id);
    }

    public List<TUser> findAllUser() {
        return jdbcTemplateDao.findAll();
    }

    public void batchAddUser(List<Object[]> list) {
        jdbcTemplateDao.batchAddUser(list);
    }

    public void batchUpdateUser(List<Object[]> list) {
        jdbcTemplateDao.batchUpdateUser(list);
    }

    public void batchDeleteUser(List<Object[]> list) {
        jdbcTemplateDao.batchDeleteUser(list);
    }
}
